package com.shhm.business.mapper;

import com.shhm.business.dto.request.SubmitOrderReq;
import com.shhm.business.dto.response.OrderDetailResp;
import com.shhm.business.dto.response.ProductInfoResp;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * @author JackZ
 * @version 1.0
 * @description: TODO
 * @date 2025/9/12 下午4:12
 */
@Mapper
public interface ProductInfoMapper {
    ProductInfoResp selectProductInfo(Integer productId);

//    @Update("update tb_order set order_status=#{info.afterOrderStatus},data_version=data_version+1 where order_num=#{info.orderNum} and order_status=#{info.beforeOrderStatus} and data_version=#{info.dataVersion}")
    Integer submitOrder(@Param("info") SubmitOrderReq req);

    OrderDetailResp selectOrderInfo(String orderNum,long userId);

    @Update("update tb_product_status set product_status=1 where product_num=(select product_num from tb_product where product_id=(select product_id from tb_order where order_num=#{orderNum}))")
    boolean productStatxusReturn(String orderNum);
}
